package org.csu.mypetstore.persistence;

import org.apache.ibatis.annotations.Param;
import org.csu.mypetstore.domain.CartItem;
import org.csu.mypetstore.domain.Item;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;

@Repository
public interface CartMapper {
    int updateItemByUsernameAndItemId(@Param("userId")String userId,@Param("itemId")String itemId,@Param("quantity")int quantity,@Param("totalCost")BigDecimal totalCost);
    CartItem selectItemByUsernameAndItemId(@Param("userId")String userId,@Param("itemId")String itemId);
    List<CartItem> selectItemByUsername(String userId);
    void insertItemByUsernameAndItemId(@Param("userId")String userId,@Param("itemId")String itemId,@Param("inStock")boolean inStock,@Param("quantity")int quantity,@Param("totalCost")BigDecimal totalCost);
    void removeItemByUsernameAndItemId(@Param("userId")String userId,@Param("itemId")String itemId);
    void updateItemByItemIdAndPay(@Param("userId")String userId,@Param("itemId")String itemId,@Param("pay") boolean pay);
    Item getItemByItemId(String itemId);

}
